//
//  AS_ZBOneGrabOrderCell.m
//  Hema
//
//  Created by zhangbin on 2017/8/23.
//  Copyright © 2017年 MoShi_N. All rights reserved.
//  ZB-功能注释:我的抢单详情第0行cell

#import "AS_ZBOneGrabOrderCell.h"
#import "ASRichLabel.h"
#import "UIImageView+WebCache.h"
#import "ASRichLabel+NSAttributeString.h"
#define serviceChargeFont       [UIFont systemFontOfSize:20 * APP_SCREEN_WIDTH / 375]
#define moneyFont               [UIFont systemFontOfSize:17 * APP_SCREEN_WIDTH / 375]
#define morecontentFont         [UIFont systemFontOfSize:14 * APP_SCREEN_WIDTH / 375]
#define contentFont             [UIFont systemFontOfSize:13 * APP_SCREEN_WIDTH / 375]
#define smallChargewordFont     [UIFont systemFontOfSize:12 * APP_SCREEN_WIDTH / 375]

#define scoreLabelFont     [UIFont systemFontOfSize:15 * APP_SCREEN_WIDTH / 375]

#define smallCatergoryFont     [UIFont systemFontOfSize:14 * APP_SCREEN_WIDTH / 375]
#define bigCatergoryFont     [UIFont systemFontOfSize:16 * APP_SCREEN_WIDTH / 375]

@interface AS_ZBOneGrabOrderCell()
@property(nonatomic,strong)UIView *topView;
@property(nonatomic,strong)UIView *leftView;
@property(nonatomic,strong)UIView *midView;
@property(nonatomic,strong)UIView *bottomView;

/** 订单编号*/
@property(nonatomic,strong)UILabel *orderNumberLabel;
/** 距离图片*/
@property(nonatomic,strong)UIImageView *distanceImg;
/** 距离label*/
@property(nonatomic,strong)UILabel *distanceLabel;
/** 横线view*/
@property(nonatomic,strong)UIView *hLine;


/** 用户头像*/
@property(nonatomic,strong)UIImageView *userImg;
/** 个人还是企业 1个人 2企业*/
@property(nonatomic,strong)UIImageView *personalImg;
/** 用户昵称*/
@property(nonatomic,strong)UILabel *userNameL;

/** 大类别*/
@property(nonatomic,strong)UILabel *bigCategoryLabel;
/** 小类别*/
@property(nonatomic,strong)UILabel *smallCategoryLabel;
/** 星星图片*/
@property(nonatomic,strong)UIImageView *starImg;
/** 分数*/
@property(nonatomic,strong)UILabel *scoreLabel;
/** 抢单时间*/
@property(nonatomic,strong)UILabel *grabOrderTimeLabel;
/** 开工时间*/
@property(nonatomic,strong)UILabel *workTimeLabel;
/** 用工地点*/
@property(nonatomic,strong)UILabel *addressLabel;
/** 联系老板*/
@property(nonatomic,strong)UIImageView *connectBoss;
/** 横线view2*/
@property(nonatomic,strong)UIView *hLine2;


/** 服务费*/
@property(nonatomic,strong)ASRichLabel *serviceChargeLabel;
/** 小费*/
@property(nonatomic,strong)ASRichLabel *tipLabel;

@property(nonatomic,strong)NSString *currentStatusStr;

@property(nonatomic,assign)NSRange serviceChargeLabelRange;

/** 开工时间图片*/
@property(nonatomic,strong)UIImageView *workOnTimeImgV;

/** 截止时间图片*/
@property(nonatomic,strong)UIImageView *endTimeImgV;

/** 工作量图片*/
@property(nonatomic,strong)UIImageView *workCountImgV;

/** 工作量label*/
@property(nonatomic,strong)UILabel *workCountLabel;


/** 佣金*/
@property(nonatomic,strong)UIImageView *moneyImgV;

@property(nonatomic,strong)UIImageView *navigationRoadImgV;


@property(nonatomic,strong)NSString *longitude;
@property(nonatomic,strong)NSString *latitude;

@end
@implementation AS_ZBOneGrabOrderCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createUI];
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}


-(void)createUI{
    /******************************************************/
    /*
    // 顶部view
    self.topView = [[UIView alloc] init];
    self.topView.backgroundColor = [UIColor clearColor];//  redColor
    [self.contentView addSubview:self.topView];
    */
    // 订单编号
    self.orderNumberLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"363636"] Font:morecontentFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.topView addSubview:self.orderNumberLabel];

    // 横线view
    self.hLine = [[UIView alloc]init];
    self.hLine.backgroundColor = [UIColor colorWithHexString:@"cacbcc"];// whiteColor
    self.hLine.alpha = 0.5;
    [self.topView addSubview:self.hLine];
    
    /******************************************************/
    // 左部view
    self.leftView = [[UIView alloc] init];
    self.leftView.backgroundColor = [UIColor clearColor];// redColor
//    [self.contentView addSubview:self.leftView];

    // 用户头像img
    self.userImg = [[UIImageView alloc]init];
    UIGestureRecognizer *workerHeadImgTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(workerHeadImgTap:)];
    self.userImg.userInteractionEnabled = YES;
    [self.userImg addGestureRecognizer:workerHeadImgTap];
    [self.leftView addSubview:self.userImg];
    
    // 个人、企业img
    self.personalImg = [[UIImageView alloc]init];
    [self.leftView addSubview:self.personalImg];
    
    // 用户昵称label
    self.userNameL = [HemaFunction labelInit:[UIColor colorWithHexString:@"898989"] Font:scoreLabelFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.leftView addSubview:self.userNameL];

    
    /******************************************************/
    // 中部view
    self.midView = [[UIView alloc] init];
    self.midView.backgroundColor = [UIColor clearColor];// blueColor
    [self.contentView addSubview:self.midView];
    
   
    
    // 大的类别
    self.bigCategoryLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"333333"] Font:bigCatergoryFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.midView addSubview:self.bigCategoryLabel];
    // 小的类别
    self.smallCategoryLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"333333"] Font:smallCatergoryFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.midView addSubview:self.smallCategoryLabel];
    
    // 星星图片
    self.starImg = [[UIImageView alloc]init];
    [self.midView addSubview:self.starImg];
    
    self.connectBoss = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"button_phone"]];
    UIGestureRecognizer *connectBossTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(connectBossTap:)];
    self.connectBoss.userInteractionEnabled = YES;
    [self.connectBoss addGestureRecognizer:connectBossTap];
//    [self.midView addSubview:self.connectBoss];
    
    // 分数
    self.scoreLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"ff8420"] Font:scoreLabelFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.midView addSubview:self.scoreLabel];
    
    // 抢单时间
    self.grabOrderTimeLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"898989"] Font:morecontentFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.midView addSubview:self.grabOrderTimeLabel];
    
    // 开工时间
    self.workTimeLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"898989"] Font:morecontentFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.midView addSubview:self.workTimeLabel];
    
   
    self.workOnTimeImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ic_time"]];
    [self.midView addSubview:self.workOnTimeImgV];
    
    self.endTimeImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ic_end"]];
    [self.midView addSubview:self.endTimeImgV];
    
    self.moneyImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ic_money"]];
    [self.midView addSubview:self.moneyImgV];
    
    // 工作量img
    self.workCountImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ic_day"]];
    [self.midView addSubview:self.workCountImgV];
    
    // 工作量label
    self.workCountLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"898989"] Font:morecontentFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.midView addSubview:self.workCountLabel];
    
    
    // 服务费
    self.serviceChargeLabel = [[ASRichLabel alloc]init];
    self.serviceChargeLabel.backgroundColor = [UIColor clearColor];// whiteColor
    self.serviceChargeLabel.textFont = morecontentFont;
    self.serviceChargeLabel.textAlignment = DCRichTextAlignmentCenter;;
    //self.serviceChargeLabel.textColor = [UIColor colorWithHexString:@"f83737"];
    self.serviceChargeLabel.textColor = [UIColor colorWithHexString:@"24b3a3"];
    [self.midView addSubview:self.serviceChargeLabel];
    
    
    /******************************************************/
    // 底部view
    self.bottomView = [[UIView alloc] init];
    self.bottomView.backgroundColor = [UIColor clearColor];// purpleColor
    [self.contentView addSubview:self.bottomView];

    // 用工地点label
    self.addressLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"898989"] Font:morecontentFont text:nil textAlignment:NSTextAlignmentCenter];
//    self.addressLabel.textAlignment = NSTextAlignmentCenter;
    self.addressLabel.numberOfLines = 0;
    [self.bottomView addSubview:self.addressLabel];
    
    // 距离图片
    self.distanceImg = [[UIImageView alloc]init];
    [self.bottomView addSubview:self.distanceImg];
    
    // 距离label
    self.distanceLabel = [HemaFunction labelInit:[UIColor colorWithHexString:@"898989"] Font:contentFont text:nil textAlignment:NSTextAlignmentCenter];
    [self.bottomView addSubview:self.distanceLabel];
    
    // 导航图片
    self.navigationRoadImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ic_direction"]];
    UIGestureRecognizer *navigationRoadImgVGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(navigationRoadImgVGestureTap:)];
    self.navigationRoadImgV.userInteractionEnabled = YES;
    [self.navigationRoadImgV addGestureRecognizer:navigationRoadImgVGesture];
    [self.bottomView addSubview:self.navigationRoadImgV];
    
    
    // 小费
    self.tipLabel = [[ASRichLabel alloc]init];
    self.tipLabel.backgroundColor = [UIColor clearColor];// whiteColor
    self.tipLabel.textFont = contentFont;
    self.tipLabel.textAlignment = DCRichTextAlignmentCenter;;
    self.tipLabel.textColor = [UIColor colorWithHexString:@"#808080"];
    [self.bottomView addSubview:self.tipLabel];
    
    // 横线view2
    self.hLine2 = [[UIView alloc]init];
    self.hLine2.backgroundColor = [UIColor colorWithHexString:@"cbcbcc"];// whiteColor
    self.hLine2.alpha = 0.5;
    [self.bottomView addSubview:self.hLine2];


    
}



-(void)setGrabOrderDetailModel:(AS_ZBGrabOrderDetailModel *)grabOrderDetailModel{
    _grabOrderDetailModel = grabOrderDetailModel;
    // 经度
    self.longitude = grabOrderDetailModel.lng;// grabOrderDetailModel.lng;
    // 纬度
    self.latitude =  grabOrderDetailModel.lat;//grabOrderDetailModel.lat;
    
//    if ([grabOrderDetailModel.statetype isEqualToString:@"0"]) {
//        self.currentStatusStr = @"待确认";
//        self.connectBoss.hidden = YES;
//        
//    }else if([grabOrderDetailModel.statetype isEqualToString:@"2"]){
//        self.currentStatusStr = @"已取消";
//        self.connectBoss.hidden = YES;
//        
//    }else if([grabOrderDetailModel.statetype isEqualToString:@"3"]){
//        self.currentStatusStr = @"已关闭";
//        self.connectBoss.hidden = YES;
//        
//    }else{
//        if([grabOrderDetailModel.checkinflag isEqualToString:@"0"]){
//            self.currentStatusStr = @"待开工";
//            self.connectBoss.hidden = NO;
//            
//        }else if([grabOrderDetailModel.checkinflag isEqualToString:@"1"]){
//            self.currentStatusStr = @"开工确认";
//            self.connectBoss.hidden = NO;
//            
//        }else{
//            if([grabOrderDetailModel.servicetype isEqualToString:@"1"]){
//                self.currentStatusStr = @"待协商";
//                self.connectBoss.hidden = YES;
//            }else{
//                if([grabOrderDetailModel.acceptflag isEqualToString:@"0"]){
//                    self.currentStatusStr = @"进行中";
//                    self.connectBoss.hidden = NO;
//                    
//                }else if([grabOrderDetailModel.acceptflag isEqualToString:@"1"]){
//                    self.currentStatusStr = @"待结账";
//                    self.connectBoss.hidden = YES;
//                    
//                    
//                }else{
//                    if([grabOrderDetailModel.replytype isEqualToString:@"0"] ){
//                        self.currentStatusStr = @"待评价";
//                        self.connectBoss.hidden = YES;
//                        
//                        
//                    }else{
//                        self.currentStatusStr = @"已完成";
//                        self.connectBoss.hidden = YES;
//                        
//                    }
//                    
//                }
//            }
//            
//        }
//    }
//    
    // 订单编号
    self.orderNumberLabel.text = [NSString stringWithFormat:@"订单编号: %@",grabOrderDetailModel.bill_sn];
    // 距离图片
    self.distanceImg.image = [UIImage imageNamed:@"ic_location"];
    // 距离label
    self.distanceLabel.text = [NSString stringWithFormat:@"距您%@km",grabOrderDetailModel.distance];
    NSLog(@"距离为%@",self.distanceLabel.text);
    // 头像
    [self.userImg setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",grabOrderDetailModel.avatar]] placeholderImage:[UIImage imageNamed:@"head_photo"]];
    // 个人/企业
    if ([grabOrderDetailModel.client_role isEqualToString:@"1"]) {
        self.personalImg.image = [UIImage imageNamed:@"geren"];
    }else{
        self.personalImg.image = [UIImage imageNamed:@"qiye"];
    }
    // 昵称
    self.userNameL.text = grabOrderDetailModel.nickname;
    // 测试大类
    self.bigCategoryLabel.text = grabOrderDetailModel.name_big;
    // 测试小类
    self.smallCategoryLabel.text = grabOrderDetailModel.name_small;
    
    self.scoreLabel.text = [NSString stringWithFormat:@"%@分",grabOrderDetailModel.score];
    
     CGFloat scoreFloat = [grabOrderDetailModel.score floatValue];
    
    if (scoreFloat <= 100 && scoreFloat >= 80) {
        self.starImg.image = [UIImage imageNamed:@"detailstar5"];

    }else if(scoreFloat < 80 && scoreFloat >= 60) {
        self.starImg.image = [UIImage imageNamed:@"detailstar4"];

    }else if(scoreFloat < 60 && scoreFloat >= 40) {
        self.starImg.image = [UIImage imageNamed:@"detailstar3"];

    }else if(scoreFloat < 40 && scoreFloat >= 20) {
        self.starImg.image = [UIImage imageNamed:@"detailstar2"];

    }else if(scoreFloat < 20 && scoreFloat >= 0) {
        self.starImg.image = [UIImage imageNamed:@"detailstar1"];
    }
    
    // 抢单时间
    NSString * string = [grabOrderDetailModel.grab_time substringFromIndex:5];
    self.grabOrderTimeLabel.text = [NSString stringWithFormat:@"抢单时间: %@",string];
    // 开工时间
     NSString * string2 = [grabOrderDetailModel.startdate substringFromIndex:5];
    self.workTimeLabel.text = [NSString stringWithFormat:@"开工时间: %@",string2];
    
    // 工作量
    self.workCountLabel.text = [NSString stringWithFormat:@"工作量: %@ %@",grabOrderDetailModel.workcount,grabOrderDetailModel.unit];
    // 用工地点
    self.addressLabel.text = [NSString stringWithFormat:@"用工地点: %@",grabOrderDetailModel.address];
    
    NSString *paycount = [NSString stringWithFormat:@"%.2f",[grabOrderDetailModel.paycount floatValue]];
    
    // 服务费
    self.serviceChargeLabel.text = [NSString stringWithFormat:@"佣金:%@元/人",paycount];
    // 小费
//    self.tipLabel.text = [NSString stringWithFormat:@"(含小费¥%@元",@"17.5"];
    
    [self setNewFrame];
    
    
    grabOrderDetailModel.cellHeight = self.midView.zb_height + self.bottomView.zb_height;
    
    

}

-(void)setNewFrame{
    
    /************************************************************/
    self.topView.frame = CGRectMake(0, 0, self.zb_width, autoScaleH(40));
    CGSize orderNumberLabelSize = [self.orderNumberLabel.text sizeWithAttributes:@{NSFontAttributeName:morecontentFont}];
    self.orderNumberLabel.frame = CGRectMake(autoScaleW(12), (self.topView.zb_height - orderNumberLabelSize.height) / 2, orderNumberLabelSize.width,orderNumberLabelSize.height);
    
    // 距离label
    //CGSize distanceLabelSize = [self.distanceLabel.text sizeWithAttributes:@{NSFontAttributeName:contentFont}];
    //self.distanceLabel.frame = CGRectMake(self.zb_width - autoScaleW(12) - distanceLabelSize.width,(self.topView.zb_height - distanceLabelSize.height)/ 2, distanceLabelSize.width, distanceLabelSize.height);
    
    self.hLine.frame = CGRectMake(0, self.topView.zb_height - 1, self.zb_width, 1);
    
    /************************************************************/
    //self.leftView.frame = CGRectMake(0, CGRectGetMaxY(self.topView.frame), autoScaleW(73), autoScaleH(90));
    self.leftView.frame = CGRectMake(0,autoScaleH(12), autoScaleW(73), autoScaleH(90));
    self.userImg.frame = CGRectMake(autoScaleW(12), autoScaleH(6), autoScaleW(50), autoScaleH(50));
    self.userImg.layer.masksToBounds = YES;
    self.userImg.layer.cornerRadius = autoScaleW(25);
    // 个人/企业认证图片的frame
    self.personalImg.frame = CGRectMake(self.userImg.zb_centerX - autoScaleW(35) / 2, CGRectGetMaxY(self.userImg.frame) - autoScaleH(6), autoScaleW(35), autoScaleH(14));
    // 用户昵称的frame
    CGSize userNameLSize = [self.userNameL.text sizeWithAttributes:@{NSFontAttributeName:scoreLabelFont}];
    self.userNameL.frame = CGRectMake(self.userImg.zb_centerX - userNameLSize.width / 2, CGRectGetMaxY(self.personalImg.frame) + autoScaleW(10), userNameLSize.width, userNameLSize.height);
    /************************************************************/
    // 中部view
    self.midView.frame = CGRectMake(0, self.leftView.zb_Y, self.zb_width - autoScaleW(73), autoScaleH(90));
    
    CGSize bigCategoryLabelSize = [self.bigCategoryLabel.text sizeWithAttributes:@{NSFontAttributeName:bigCatergoryFont}];
    // 大类
    self.bigCategoryLabel.frame = CGRectMake(autoScaleW(12),autoScaleH(12), bigCategoryLabelSize.width, bigCategoryLabelSize.height);
    CGSize smallCategoryLabelSize = [self.smallCategoryLabel.text sizeWithAttributes:@{NSFontAttributeName:smallCatergoryFont}];
    // 小类
    self.smallCategoryLabel.frame = CGRectMake(CGRectGetMaxX(self.bigCategoryLabel.frame) + autoScaleW(12), self.bigCategoryLabel.zb_centerY - smallCategoryLabelSize.height / 2, smallCategoryLabelSize.width, smallCategoryLabelSize.height);
    // 星星
//    self.starImg.frame = CGRectMake(autoScaleW(12), CGRectGetMaxY(self.smallCategoryLabel.frame) + autoScaleH(10), autoScaleW(170 / 2), autoScaleH(30 / 2));
    
//    CGSize scoreLabelSize = [self.scoreLabel.text sizeWithAttributes:@{NSFontAttributeName:scoreLabelFont}];
    // 分数
//    self.scoreLabel.frame = CGRectMake(CGRectGetMaxX(self.starImg.frame) + autoScaleW(10), self.starImg.zb_centerY - scoreLabelSize.height / 2, scoreLabelSize.width, scoreLabelSize.height);
    
    self.workOnTimeImgV.frame = CGRectMake(autoScaleW(11), CGRectGetMaxY(self.smallCategoryLabel.frame) + autoScaleH(18), autoScaleW(18), autoScaleH(18));
    
    
    // 开工时间
    CGSize workTimeLabelSize = [self.workTimeLabel.text sizeWithAttributes:@{NSFontAttributeName:morecontentFont}];
    self.workTimeLabel.frame = CGRectMake(CGRectGetMaxX(self.workOnTimeImgV.frame) + autoScaleW(6), self.workOnTimeImgV.zb_Y, workTimeLabelSize.width, workTimeLabelSize.height);
    
    
    self.endTimeImgV.frame = CGRectMake(autoScaleW(11), CGRectGetMaxY(self.workOnTimeImgV.frame) + autoScaleH(12), autoScaleW(18), autoScaleH(18));
    
    // 抢单时间
    CGSize grabOrderTimeLabelSize = [self.grabOrderTimeLabel.text sizeWithAttributes:@{NSFontAttributeName:morecontentFont}];
    self.grabOrderTimeLabel.frame = CGRectMake(CGRectGetMaxX(self.endTimeImgV.frame) + autoScaleW(6), self.endTimeImgV.zb_Y, grabOrderTimeLabelSize.width, grabOrderTimeLabelSize.height);
    
    // 工作量
    self.workCountImgV.frame = CGRectMake(autoScaleW(11), CGRectGetMaxY(self.endTimeImgV.frame) + autoScaleH(12), autoScaleW(18), autoScaleH(18));
    
    
    //
    CGSize workCountLabelSize = [self.workCountLabel.text sizeWithAttributes:@{NSFontAttributeName:morecontentFont}];
    self.workCountLabel.frame = CGRectMake(CGRectGetMaxX(self.endTimeImgV.frame) + autoScaleW(6), self.workCountImgV.zb_Y, workCountLabelSize.width, workCountLabelSize.height);
    
    
    self.moneyImgV.frame = CGRectMake(autoScaleW(11), CGRectGetMaxY(self.workCountImgV.frame) + autoScaleH(12), autoScaleW(18), autoScaleH(18));
    
    
   
    
    //    NSRange serviceChargeLabelRange = NSMakeRange(1,grabOrderDetailModel.paycount.length);
    //    self.serviceChargeLabelRange = serviceChargeLabelRange;
    CGSize serviceChargeLabelSize = [self.serviceChargeLabel.text sizeWithAttributes:@{NSFontAttributeName:morecontentFont}];
    self.serviceChargeLabel.frame = CGRectMake(CGRectGetMaxX(self.moneyImgV.frame) + autoScaleW(6), self.moneyImgV.zb_Y, serviceChargeLabelSize.width, serviceChargeLabelSize.height);
    //    [self.serviceChargeLabel makeupTextRange:serviceChargeLabelRange
    //                                        font:serviceChargeFont color:[UIColor colorWithHexString:@"f83737"]];
    
   
    
    // 联系雇主
//    self.connectBoss.frame = CGRectMake(self.midView.zb_width - autoScaleW(12) - autoScaleW(40), autoScaleH(50), autoScaleW(40), autoScaleH(40));
    
    self.midView.frame = CGRectMake(0,0,self.zb_width - autoScaleW(73),CGRectGetMaxY(self.moneyImgV.frame) + autoScaleH(12));
    /************************************************************/
    // 底部view
    self.bottomView.frame = CGRectMake(0, CGRectGetMaxY(self.midView.frame), self.zb_width, autoScaleH(80));
    
    // 用工地点
//    CGSize addressLabelSize = [self.addressLabel.text sizeWithAttributes:@{NSFontAttributeName:morecontentFont}];
     CGSize addressLabelSize = [self.addressLabel.text boundingRectWithSize:CGSizeMake(APP_SCREEN_WIDTH - autoScaleW(12) - autoScaleW(40) - autoScaleW(35), MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:morecontentFont} context:nil].size;
    self.addressLabel.frame = CGRectMake(autoScaleW(12), autoScaleH(10), self.zb_width - autoScaleW(73) - autoScaleW(12), addressLabelSize.height);
    
    // 距离图片
    self.distanceImg.frame = CGRectMake(self.addressLabel.zb_X, (CGRectGetMaxY(self.addressLabel.frame) + autoScaleH(5)), autoScaleW(16), autoScaleH(16));
    
    // 距离label
    CGSize distanceLabelSize = [self.distanceLabel.text sizeWithAttributes:@{NSFontAttributeName:contentFont}];
    self.distanceLabel.frame = CGRectMake(CGRectGetMaxX(self.distanceImg.frame) + autoScaleW(10),self.distanceImg.zb_Y, distanceLabelSize.width, distanceLabelSize.height);
   
    // 导航图片
    self.navigationRoadImgV.frame = CGRectMake(self.zb_width - autoScaleW(20) - autoScaleW(25), (autoScaleH(70) - autoScaleH(30)) / 2, autoScaleW(25), autoScaleH(25));
    
     self.bottomView.frame = CGRectMake(0, CGRectGetMaxY(self.midView.frame), self.zb_width, CGRectGetMaxY(self.distanceLabel.frame) + autoScaleH(10));
//
//    CGSize tipLabelSize = [self.tipLabel.text sizeWithAttributes:@{NSFontAttributeName:contentFont}];
//    self.tipLabel.frame = CGRectMake(CGRectGetMaxX(self.serviceChargeLabel.frame) + autoScaleW(10), CGRectGetMaxY(self.serviceChargeLabel.frame) - tipLabelSize.height , tipLabelSize.width, tipLabelSize.height);
    
    self.hLine2.frame = CGRectMake(0, 0, self.zb_width, 1);
}

-(void)layoutSubviews{
    [super layoutSubviews];
    [self setNewFrame];
}

-(void)workerHeadImgTap:(UITapGestureRecognizer *)gesture{
    
    if (self.headImgClick) {
        self.headImgClick();
    }
}

-(void)connectBossTap:(UITapGestureRecognizer *)gesture{
    
    if (self.connectBossClick) {
        self.connectBossClick();
    }
}

- (void)navigationRoadImgVGestureTap:(UITapGestureRecognizer *)recognizer {
    if(self.navigationRoadClick){
        self.navigationRoadClick(self.longitude, self.latitude);
    }
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
